VERSION 5.00
Begin VB.Form FrmBusqueda 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Busqueda "
   ClientHeight    =   6555
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   13995
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6555
   ScaleWidth      =   13995
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   WindowState     =   2  'Maximized
   Begin VB.Timer Timer1 
      Interval        =   100
      Left            =   8880
      Top             =   480
   End
   Begin VB.ListBox List2 
      Columns         =   3
      Height          =   5325
      Left            =   3720
      TabIndex        =   7
      Top             =   1200
      Visible         =   0   'False
      Width           =   495
   End
   Begin VB.ListBox List1 
      Columns         =   3
      Height          =   5325
      Left            =   120
      TabIndex        =   6
      Top             =   1200
      Width           =   13935
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Cancelar"
      Height          =   255
      Left            =   5160
      TabIndex        =   5
      Top             =   360
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   240
      TabIndex        =   0
      Top             =   360
      Width           =   2775
   End
   Begin VB.ComboBox Combo1 
      Height          =   315
      Left            =   3120
      TabIndex        =   1
      Top             =   360
      Width           =   1815
   End
   Begin VB.Label SkinLabel3 
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   720
      Width           =   4815
   End
   Begin VB.Label SkinLabel1 
      Caption         =   "Valor a buscar:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   120
      Width           =   1815
   End
   Begin VB.Label SkinLabel2 
      Caption         =   "Campo:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3120
      TabIndex        =   3
      Top             =   120
      Width           =   1335
   End
End
Attribute VB_Name = "FrmBusqueda"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public tabla
Public CampoDefecto
Public UnicoCampo As Boolean
Public CampoResultado
Public Resultado

Private Sub Command1_Click()

End Sub

Private Sub Command2_Click()
Unload Me

End Sub

Private Sub Form_Load()
On Error GoTo e
    Dim t As DAO.Recordset
    Me.Caption = titulo2("Busqueda")
    
    Combo1.Text = CampoDefecto
    Set t = Base.OpenRecordset(tabla)
    For i = 0 To t.Fields.Count - 1
        Combo1.AddItem t.Fields(i).Name
    Next
    If UnicoCampo Then
        Combo1.Locked = True
    Else
        Combo1.Locked = False
    End If
e:

End Sub

Private Sub List1_DblClick()
       Resultado = List2.list(List1.ListIndex)
       Unload Me
End Sub

Private Sub Text1_Change()
    Dim t As DAO.Recordset
    Set t = Base.OpenRecordset(tabla + " and  [" & Combo1.Text & "] like'" & Text1.Text & "*'")
    c = 0
    List1.Clear
    List2.Clear
    x = ""
    While Not t.EOF
        c = c + 1
        List1.AddItem t(Combo1.Text)
        List2.AddItem t(CampoResultado)
        t.MoveNext
    Wend
    SkinLabel3.Caption = "Se encontraron " & c & " coincidencias:"
    
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
On Error Resume Next
    If KeyAscii = 13 Then
        Resultado = List2.list(0)
        Unload Me
    End If
End Sub

Private Sub Timer1_Timer()
    Timer1.Enabled = False
    Text1.SetFocus
End Sub
